<template>
  <van-config-provider :theme-vars="themeVars">
    <div id="app">
      <router-view v-slot="{ Component }">
        <transition name="fade" mode="out-in">
          <component :is="Component" />
        </transition>
      </router-view>
    </div>
  </van-config-provider>
</template>

<script setup>
import { computed } from 'vue'

const themeVars = computed(() => ({
  // 主色调 - 蓝紫色
  primaryColor: '#5b6cf9',
  
  // 背景色
  background: '#f5f7fa',
  background2: '#ffffff',
  
  // 文字颜色
  textColor: '#1f2937',
  textColor2: '#4b5563',
  textColor3: '#9ca3af',
  
  // 边框颜色
  borderColor: '#e5e7eb',
  
  // 按钮
  buttonPrimaryBackground: 'linear-gradient(135deg, #5b6cf9 0%, #8b5cf6 100%)',
  buttonPrimaryBorderColor: '#5b6cf9',
  
  // 单元格
  cellBackground: '#ffffff',
  
  // NavBar
  navBarBackground: '#ffffff',
  navBarTitleTextColor: '#1f2937',
  navBarIconColor: '#1f2937',
  
  // TabBar
  tabbarBackground: '#ffffff',
  tabbarItemActiveColor: '#5b6cf9',
  
  // 弹出层
  popupBackground: '#ffffff',
  
  // ActionSheet
  actionSheetItemBackground: '#ffffff',
  actionSheetCancelTextColor: '#ef4444',
  
  // Calendar
  calendarBackground: '#ffffff',
  calendarPopupBackground: '#ffffff',
  calendarHeaderTitleColor: '#1f2937',
  calendarWeekdaysColor: '#6b7280',
  calendarDayTextColor: '#1f2937',
  calendarSelectedDayBackground: '#5b6cf9',
  
  // Tag
  tagPrimaryColor: '#5b6cf9',
  tagSuccessColor: '#10b981',
  tagWarningColor: '#f59e0b',
  tagDangerColor: '#ef4444'
}))
</script>

<style>
:root {
  --app-bg: #f5f7fa;
  --card-bg: #ffffff;
  --card-bg-hover: #f9fafb;
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --border-color: #e5e7eb;
  --accent-primary: #5b6cf9;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #5b6cf9 0%, #8b5cf6 100%);
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #3b82f6;
  
  /* 日期类型颜色 - 亮色主题 */
  --workday-bg: #f0f4ff;
  --weekend-bg: #fef3c7;
  --holiday-bg: #fee2e2;
  --makeup-bg: #d1fae5;
  --rest-bg: #ede9fe;
  --trip-start-bg: #d1fae5;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background-color: var(--app-bg);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 页面过渡动画 */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.2s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Vant 组件样式覆盖 */
.van-toast {
  background: var(--card-bg) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.van-dialog {
  background: var(--card-bg) !important;
}

.van-dialog__header {
  color: var(--text-primary) !important;
}

.van-dialog__message {
  color: var(--text-secondary) !important;
}

.van-popup {
  background: var(--card-bg) !important;
}

.van-action-sheet__item {
  background: var(--card-bg) !important;
  color: var(--text-primary) !important;
}

.van-action-sheet__cancel {
  background: var(--card-bg) !important;
}

.van-action-sheet__gap {
  background: var(--app-bg) !important;
}

.van-cell {
  background: transparent !important;
}

.van-cell::after {
  border-color: var(--border-color) !important;
}

.van-field__control {
  color: var(--text-primary) !important;
}

.van-field__control::placeholder {
  color: var(--text-muted) !important;
}

/* 安全区域适配 */
.safe-area-bottom {
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}
</style>
